import com.sun.org.apache.bcel.internal.generic.SWAP;

public class Test {
    public static  void func1(int n){
        int count = 0;
        for (int i = 0; i <n ; i++) {
            for (int j = 0; j < n; j++) {
                count++;
            }
        }
    }
    public static int biarySeaarch(int[] array,int value){
        int begin = 0;
        int end = array.length -1;
        while (begin <= end) {
            int mid = (begin + end) / 2;
            if (array[mid] > value) {
                end = mid - 1;
            }else if (array[mid]<value){
                    begin = mid + 1;
                }else {
                return mid;
            }
        }
        return -1;
    }
    public void bubbleSort(int[] array){
        for (int end = array.length; end > 0; end--) {
            boolean sorted = true;
            for (int i = 1;i< end;i++){
                if (array[i - 1] > array[i]){
                    int tmp = array[i];
                    array [i] = array[i-1];
                    array[i-1]= tmp;
                    sorted = false;
                }
            }
            if (sorted = true){
                break;
            }
        }
    }
}
